package util;

import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Workbook;

public class ExcelStyleUtil {
    /**
     * 表头字体
     *
     * @return
     */
    public static Font tableHeaderFoot(Workbook wb) {
        Font headerFont = wb.createFont();
        headerFont.setFontHeightInPoints((short) 16);
        headerFont.setFontName("宋体");
        headerFont.setBold(true);
        headerFont.setColor(IndexedColors.BLACK.getIndex());
        return headerFont;
    }

    /**
     * 表头样式-左右上下居中
     *
     * @param wb
     * @return
     */
    public static CellStyle tableHeaderStyle(Workbook wb) {
        CellStyle headerStyle = wb.createCellStyle();
        Font font = tableHeaderFoot(wb);
        headerStyle.setFont(font);
        return headerStyle;
    }

}
